<template>
    <div>
        <h1>第二个测试页面</h1>
        <div>
            {{ $store.state.num }}
        </div>
        <button @click="update">修改全局数据</button>
        <button @click="fn">调用全局方法</button>
        <button @click="fn1">调用全局方法</button>
    </div>
</template>
<script>
export default {
    methods:{
        update(){
            this.$store.state.num++;
        },
        fn(){
            this.$store.commit("changeNum",10);
        },
        fn1(){
            this.$store.dispatch("asyncChangeNum",100);
        }
    }

    
}
</script>